Skip to content

Enhancement - Support AMDGPU_TARGETS in ROCm CMake builds#793

Open
polarG wants to merge 3 commits intomainfrom
dev/hongtaozhang/fix-rocm-without-gpu-arch-set
Open

Enhancement - Support AMDGPU_TARGETS in ROCm CMake builds#793
polarG wants to merge 3 commits intomainfrom
dev/hongtaozhang/fix-rocm-without-gpu-arch-set

Conversation

@polarG
Copy link
Copy Markdown
Contributor

@polarG polarG commented Mar 25, 2026

Description
Allow specifying AMD GPU architectures via the AMDGPU_TARGETS environment variable in rocm_common.cmake. This fixes builds on machines without a GPU (e.g., CI) where hipcc auto-detection fails. When unset, the previous auto-detection behavior is preserved.

@polarG polarG requested a review from a team as a code owner March 25, 2026 22:44
Copilot AI review requested due to automatic review settings March 25, 2026 22:44
@polarG polarG self-assigned this Mar 25, 2026
@polarG polarG added enhancement New feature or request containers SuperBench Containers ROCm labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for driving ROCm/HIP GPU architecture selection from the AMDGPU_TARGETS environment variable during CMake configuration, to make ROCm micro-benchmark builds work on hosts where hipcc GPU auto-detection is unavailable (e.g., CI without a GPU).

Changes:

  • Read AMDGPU_TARGETS from the environment and convert it to a CMake list for use during configuration.
  • Cache AMDGPU_TARGETS and (for CMake ≥ 3.21) set CMAKE_HIP_ARCHITECTURES when the env var is provided.
  • Preserve the prior “auto-detection” path when AMDGPU_TARGETS is not set, and add status logging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread superbench/benchmarks/micro_benchmarks/rocm_common.cmake Outdated
Comment thread superbench/benchmarks/micro_benchmarks/rocm_common.cmake Outdated
Comment thread superbench/benchmarks/micro_benchmarks/rocm_common.cmake Outdated
Comment thread superbench/benchmarks/micro_benchmarks/rocm_common.cmake Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.69%. Comparing base (036c471) to head (3800dbd).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #793   +/-   ##
=======================================
  Coverage   85.69%   85.69%           
=======================================
  Files         103      103           
  Lines        7890     7890           
=======================================
  Hits         6761     6761           
  Misses       1129     1129           
Flag Coverage Δ
cpu-python3.10-unit-test 70.42% <ø> (ø)
cpu-python3.12-unit-test 70.42% <ø> (ø)
cpu-python3.7-unit-test 69.85% <ø> (ø)
cuda-unit-test 83.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Hongtao Zhang added 2 commits April 27, 2026 21:49
- Clarify comment: micro-benchmarks are CXX-only via hipcc; CMAKE_HIP_ARCHITECTURES
  is set only for compatibility with HIP-language projects, not required here.
- Normalize whitespace via STRIP + REGEX REPLACE [ \t]+ to avoid empty list
  elements from leading/trailing or repeated whitespace.
- Add FORCE to the cache set so a changed AMDGPU_TARGETS env value overrides
  any stale cached value on reconfigure.
- Replace DEFINED ENV check with non-empty HIP_ARCH_LIST check so an empty or
  whitespace-only AMDGPU_TARGETS falls back to hipcc auto-detection.
- Broaden the separator regex to accept whitespace, ',', and ';' so
  values like 'gfx908,gfx90a' or CMake-list 'gfx908;gfx90a' are parsed
  correctly instead of becoming a single bogus token.
- Drop CACHE STRING ... FORCE: use a normal directory-scoped variable
  for AMDGPU_TARGETS so we do not pollute the global CMake cache or
  override the variable in nested projects. The env var is re-read on
  every reconfigure, so this still wins over stale state.
Copilot AI review requested due to automatic review settings May 3, 2026 04:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

containers SuperBench Containers enhancement New feature or request ROCm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants